@checkbox-prefix-cls: ~'@{css-prefix}checkbox';
@checkbox-group-prefix-cls: ~'@{checkbox-prefix-cls}-group';
@checkbox-inner-prefix-cls: ~'@{checkbox-prefix-cls}-inner';
@checkbox-group-button-prefix-cls: ~'@{checkbox-group-prefix-cls}-button';

.@{checkbox-prefix-cls}-focus {
  // box-shadow: 0 0 0 2px fade(@color-brand-primary, 20%);
  z-index: 1;
}

.@{checkbox-group-prefix-cls} {
  display: inline-block;
  font-size: @font-size-base;
  vertical-align: middle;

  //outline: none;
  &-vertical {
    .@{checkbox-prefix-cls}-wrapper {
      display: block;
      height: 30px;
      line-height: 30px;
    }
  }
}

// 普通状态 - Normal state
.@{checkbox-prefix-cls}-wrapper {
  font-size: @font-size-base;
  vertical-align: middle;
  display: inline-block;
  position: relative;
  white-space: nowrap;
  margin-right: 8px;
  cursor: pointer;

  &-disabled {
    cursor: @cursor-disabled;
  }

  &:hover {
    .@{checkbox-inner-prefix-cls} {
      border-color: @color-brand-primary;
    }

    .@{checkbox-prefix-cls}-disabled {
      .@{checkbox-inner-prefix-cls} {
        border-color: @color-border-disable;
      }
    }
  }

  //outline: none;
}

.@{checkbox-prefix-cls} {
  display: inline-block;
  margin-right: 10px;
  white-space: nowrap;
  //outline: none;
  position: relative;
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;

  &:hover {
    .@{checkbox-inner-prefix-cls} {
      border-color: @color-brand-primary;
    }
  }

  &-inner {
    display: inline-block;
    width: 14px;
    height: 14px;
    position: relative;
    top: 0;
    left: 0;
    background-color: @color-complementary-7;
    border: 1px solid @color-border-normal1;
    border-radius: 2px;
    transition: all @transition-time @ease-in-out;

    &:after {
      content: '';
      display: table;
      width: 4px;
      height: 8px;
      position: absolute;
      top: 1px;
      left: 4px;
      border:2px solid @color-complementary-7;
      border-top: 0;
      border-left: 0;
      transform: rotate(45deg) scale(0);
      transition: all 0.2s ease-in-out;
    }
  }

  &-large {
    font-size: @font-size-large;

    & .@{checkbox-inner-prefix-cls} {
      width: 14px;
      height: 14px;

      &:after {
        top: 0px;
        left: 3px;
        width: 5px;
        height: 9px;
      }
    }

    &.@{checkbox-prefix-cls}-wrapper,
    & .@{checkbox-prefix-cls}-wrapper {
      font-size: @font-size-large;
    }
  }

  &-small {
    & .@{checkbox-inner-prefix-cls} {
      width: 14px;
      height: 14px;

      &:after {
        top: 2px;
        left: 4px;
        width: 3px;
        height: 7px;
      }
    }
  }

  &-input {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
    opacity: 0;
    cursor: pointer;
  }

  &-border {
    border: 1px solid @color-border-normal1;
    border-radius: @border-radius-base;
    height: @btn-height-base;
    line-height: @btn-height-base - 2px;
    padding: @btn-padding-base;
    transition: border @transition-time @ease-in-out;
  }

  &-small&-border,
  .@{checkbox-group-prefix-cls}-small &-border {
    height: @btn-height-small;
    line-height: @btn-height-small - 2px;
    padding: @btn-padding-small;
  }

  &-large&-border,
  .@{checkbox-group-prefix-cls}-large &-border {
    height: @btn-height-base;
    line-height: @btn-height-base - 4px;
    padding: @btn-padding-base;
  }
}

.@{checkbox-prefix-cls}-wrapper-checked.@{checkbox-prefix-cls}-border {
  border-color: @color-brand-primary;
}

.@{checkbox-prefix-cls}-wrapper-disabled.@{checkbox-prefix-cls}-border {
  border-color: @color-border-disable;
}

// 选中状态 - Selected state
.@{checkbox-prefix-cls}-checked {
  .@{checkbox-inner-prefix-cls} {
    border-color: @color-brand-primary;
    background-color: @color-brand-primary;

    &:after {
      content: '';
      display: table;
      position: absolute;
      border: 2px solid @color-functional-white;
      border-top: 0;
      border-left: 0;
      transform: rotate(45deg) scale(1);
      transition: all 0.2s ease-in-out;
      border-width: 1px;
    }
  }

  &:hover {
    .@{checkbox-inner-prefix-cls} {
      border-color: @color-brand-primary;
    }
  }
}
    // 半选状态
    .@{checkbox-prefix-cls}-indeterminate{
      .@{checkbox-inner-prefix-cls}:after{
          content: '';
          width: 10px;
          height: 10px;
          background-color: @primary-color;
          transform: scale(1);
          position: absolute;
          left: 2px;
          top: 2px;
      }

      &:hover {
          .@{checkbox-inner-prefix-cls} {
              border-color: @primary-color;
          }
      }
      .@{checkbox-inner-prefix-cls}{
          border-color: @primary-color;
      }
      &.@{checkbox-prefix-cls}-disabled{
          .@{checkbox-inner-prefix-cls}{
              background: @color-bg-card;
          }
          .@{checkbox-inner-prefix-cls}:after{
              border-color: @color-bg-card;
              background-color: @color-scrollbar;
          }
      }
  }

.@{checkbox-prefix-cls}-disabled {
  cursor: @cursor-disabled;

  .@{checkbox-prefix-cls}-input {
    cursor: @cursor-disabled;
  }

  &:hover {
    .@{checkbox-inner-prefix-cls} {
      border-color: @color-border-normal1;
    }
  }

  .@{checkbox-inner-prefix-cls} {
    border-color: @color-border-normal1;
    background-color: @color-complementary-8;
  }

  .@{checkbox-prefix-cls}-disabled + span {
    color: @color-complementary-6;
  }

  &.@{checkbox-prefix-cls}-checked .@{checkbox-inner-prefix-cls} {
    background-color: @color-border-normal1;
  }
}

span.@{checkbox-prefix-cls} + * {
  margin-left: 2px;
  margin-right: 2px;
}

// 按钮样式 - Button style
.@{checkbox-group-button-prefix-cls} {
  font-size: 0;
  -webkit-text-size-adjust: none;

  .@{checkbox-prefix-cls} {
    width: 0;
    margin-right: 0;
  }

  .@{checkbox-prefix-cls}-wrapper {
    display: inline-block;
    height: @height-middle ;
    line-height: @height-middle  - 2px;
    margin: 0;
    padding: 0 13px;
    font-size: @font-size-base;
    color:@color-complementary-12;
    transition: all @transition-time ease-in-out;
    cursor: pointer;
    border: 1px solid @color-border-normal1;
    border-left: 0;
    background:@color-bg-card;
    position: relative;

    >span {
      margin-left: 0;
    }

    &:before,
    &:after {
      content: '';
      display: block;
      position: absolute;
    }

    &:after {
    }

    &:first-child {
      border-radius: @btn-border-radius 0 0 @btn-border-radius;
      border-left: 1px solid @color-border-normal1;
    }

    &:last-child {
      border-radius: 0 @border-radius-base @border-radius-base 0;
    }

    &:first-child:last-child {
      border-radius: @border-radius-base;
    }

    &:hover {
      position: relative;
      color: @color-brand-primary;

      & .@{checkbox-prefix-cls} {
        background-color: black;
      }
    }

    .@{checkbox-prefix-cls}-inner,
    input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    &-checked {
      background-color: @color-bg-nomal;
      border-color: @color-brand-primary;
      color: @color-brand-primary;
      box-shadow: -1px 0 0 0 @color-brand-primary;
      z-index: 1;

      &:before{
        content: '';
        top: -1px;
        right: -1px;
        margin-right: 0px;
        border-width: 0 10px 10px 0;
        border-style: solid;
        border-color: transparent @color-brand-primary;
      }
      &:after{
        font-family: @ionicons-font-family !important;
        content: '\f171';
        top: calc(-25% - 16px);
        color: @color-functional-white;
        right: -4px;
      }

      &.@{checkbox-prefix-cls}-focus {
        &:after {

        }

        &:first-child {
        }
      }

      &:first-child {
        border-color: @color-brand-primary;
        box-shadow: none;
      }

      &:hover {
        border-color: tint(@color-brand-primary, 20%);
        //box-shadow: -1px 0 0 0 tint(@color-brand-primary, 20%);
        // color: tint(@color-brand-primary, 20%);
      }

      &:active {
        border-color: shade(@color-brand-primary, 5%);
        //box-shadow: -1px 0 0 0 shade(@color-brand-primary, 5%);
        color: shade(@color-brand-primary, 5%);
      }
    }

    &-disabled {
      border-color: @color-border-normal1;
      background-color: @color-bg-page;
      cursor: @cursor-disabled;
      color: @color-complementary-6;

      &:first-child,
      &:hover {
        border-color: @color-border-normal1;
        background-color: @color-bg-page;
        color: @color-complementary-6;
      }

      &:first-child {
        border-left-color: @color-border-normal1;
      }
    }

    &-disabled.@{checkbox-prefix-cls}-wrapper-checked {
      color: @color-complementary-6;
      background-color: @color-complementary-8;
      border-color: @color-border-normal1;
      box-shadow: none !important;
      &:before{
        content: '';
        top: -1px;
        right: -1px;
        margin-right: 0px;
        border-width: 0 10px 10px 0;
        border-style: solid;
        border-color: transparent @color-complementary-5;
      }
    }
  }

  &-solid .@{checkbox-prefix-cls}-wrapper {
    &-checked:not(.@{checkbox-prefix-cls}-wrapper-disabled) {
      background: @color-brand-primary;
      color: @color-functional-white;
      &:hover {
        background: tint(@color-brand-primary, 20%);
        color: @color-functional-white;
      }
    }
  }
}

.@{checkbox-prefix-cls}-large {
  .@{checkbox-prefix-cls}-wrapper{
    height: @btn-height-base;
    line-height: @btn-height-base - 2px;
    font-size: @font-size-base;
  }
}

.@{checkbox-prefix-cls}-small{
  .@{checkbox-prefix-cls}-wrapper{
      height: @btn-height-small;
      line-height: @btn-height-small - 2px;
      font-size: @font-size-base;

      &:first-child {
        border-radius: @border-radius-base 0 0 @border-radius-base;
      }

      &:last-child {
        border-radius: 0 @border-radius-base @border-radius-base 0;
      }
    }
  }

